

import java.rmi.Naming;

public class RmiClient {
	
	public static void main(String[] args) {
		try {
			IRmiService service = (IRmiService) Naming.lookup("service02");
			Class stubClass = service.getClass();
			System.out.println(service + " is " + stubClass.getName() + " example");
			Class[] interfaces = stubClass.getInterfaces();
			for (Class c : interfaces) {
				System.out.println("client class implements " + c.getName() +" interface");
			}
			System.out.println(service.service("Hello! Nice to meet you!"));
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
}
